@extends('admin_system.layout.layout')

@section('content')
    <br>
    <style>
        .container {
            width: 100%;
        }

        a {
            text-decoration: none;

        }
    </style>
    <div class="list-group">
        <div href="#" class="list-group-item active">
            <h4 class="list-group-item-heading"><strong>当前位置:</strong><span>企业帐号管理>></span><span>帐号管理</span></h4>
            <br>
            <div class="list-group-item-text"
                 style="display: flex;justify-content: space-between;align-content: space-between;width: 100%">
                <div class="form-group" style="width: 50%">
                    <div class="clearfix"></div>
                    <label for="serarch" class="control-label">查询企业:</label>
                    <form action="{{asset('admin_system/accountsManage/index')}}" method="post">
                        {{csrf_field()}}
                        <div style="width: 80%;display: flex;justify-content: space-between">
                            <input  value="{{$keywords}}" name="keywords"  class="form-control pull-left" style="margin-right:20px;">
                            <button type="submit" class="btn btn-info pull-left" style="width: 35%;height: 35px">查询</button>

                            <div class="clearfix"></div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>


    <div class="panel panel-default">
        <div class="panel-body">
            <table class="table table-bordered table-hover">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>企业名称</th>
                    <th>企业编号</th>
                    <th>管理员</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $k => $v)
                    <tr>
                        <td>{{$v->company_id}}</td>
                        <td style="width: 20%">{{$v->company_name}}</td>
                        <td>{{$v->company_sn}}</td>
                        <td>
                            @if(count($v->managers)>0)
                                <table class="table table-bordered">
                                    <tr>
                                        <th>姓名</th>
                                        <th>手机号</th>
                                    </tr>
                                    @foreach($v->managers as $manager)
                                    
                                    <tr>
                                        <td>{{$manager->manage_name}}</td>
                                        <td>{{$manager->name}}</td>
                                    </tr>    
                                    @endforeach        
                                </table>
                            @endif

                        </td>
                        <td>
                            <a href="{{route('account_add',['companyId'=>$v->company_id])}}">
                                <button type="submit" class="btn btn-info pull-left">添加管理员</button>
                            </a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>

            {!! $data->appends(['keywords'=>$keywords])->links() !!}
        </div>
    </div>
@stop